{% extends "manager/base.html" %}

{% block content %}
<div class="container mt-4">
    <h2>用户管理</h2>
    <a href="{% url 'user_add' %}" class="btn btn-primary mb-3">
        <i class="bi bi-plus-circle"></i> 添加用户
    </a>

    <table class="table table-striped table-bordered">
        <thead class="thead-dark">
            <tr>
                <th>ID</th>
                <th>用户名</th>
                <th>用户类型</th>
                <th>创建时间</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            {% for user in users %}
            <tr>
                <td>{{ user.id }}</td>
                <td>{{ user.username }}</td>
                <td>{{ user.get_user_type_display }}</td>
                <td>{{ user.createTime|date:"Y-m-d" }}</td>
                <td>
                    <a href="{% url 'user_edit' user.id %}" class="btn btn-sm btn-warning">
                        <i class="bi bi-pencil"></i> 编辑
                    </a>
                    <a href="{% url 'user_delete' user.id %}" class="btn btn-sm btn-danger">
                        <i class="bi bi-trash"></i> 删除
                    </a>
                </td>
            </tr>
            {% empty %}
            <tr>
                <td colspan="5" class="text-center">暂无用户数据</td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
</div>
{% endblock %}